
<form id="accountChangePassword" class="full relative">
    <h1 class="title-big-01"><?=$LANG["label"]["CHANGEPASSWORD"];?></h1>
    <div class="clear group-table-1">
        <div class="table-management-2">
            <div class="row head clear">
                <span><?=$LANG["label"]["INFORMATIONOFUSER"];?></span>
            </div>
            <div class="row clear">
                <span class="col caption"><?=$LANG["label"]["USERNAME"];?> </span>
                <span class="col">
                    <span><?= $arr['Username'] ?></span>
                </span>
            </div>
            <div class="row clear">
                <span class="col caption"><?=$LANG["label"]["EMAIL"];?> </span>
                <span class="col">
                    <span><?= $arr['Email'] ?></span>
                </span>
            </div>
            <div class="row clear">
                <span class="col caption"><?=$LANG["label"]["OLDPASSWORD"];?></span>
                <span class="col">
                    <input type="password" value="" name="oldPassword">
                    <div class="notification"></div>
                </span>
            </div>
            <div class="row clear">
                <span class="col caption"><?=$LANG["label"]["NEWPASSWORD"];?></span>
                <span class="col">
                    <input type="password" value="" name="newPassword">
                    <div class="notification"></div>
                </span>
            </div>
            <div class="row clear">
                <span class="col caption"><?=$LANG["label"]["PASSWORDCONFIRM"];?></span>
                <span class="col">
                    <input type="password" value="" name="confirmPassword">
                    <div class="notification"></div>
                </span>
            </div>
        </div>
    </div>

    <div class="row-group-submit-tbm2 clear">
        <input type="hidden" name="playerID" value="<?= $_SESSION['agentLog']['PlayerID'] ?>"/>
        <input type="button" value="<?=$LANG["label"]["CHANGEPASSWORD"];?>" name="submit">
    </div>
</form>


<script>
    var url = URL_LODE + '/View/agent-management-taikhoan.php';

    $('#accountChangePassword input[name="submit"]').click(function() {
        $.ajax({
            url: url,
            type: 'POST',
            beforeSend: function() {
                mb.createloadingTable1('#contentManagement > .overlay-loading');
            },
            data: {
                tab: "changepassworduser",
                action: 'changepassword',
                oldpassword: $('input[name="oldPassword"]').val(),
                newpassword: $('input[name="newPassword"]').val(),
                playerid: $('input[name="playerID"]').val()
            },
            success: function(data) {
                if (data == -1)
                    openDialogMessage("Thông Báo", "Mật khẩu cũ không đúng !");
                else if (data == 0)
                    openDialogMessage("Thông Báo", "Đổi mật khẩu thất bại !");
                else if (data == 1)
                    openDialogMessage("Thông Báo", "Đổi mật khẩu thành công !");
            },
            complete: function() {
                mb.destroyloadingTable1();
            }
        });
    });
</script>